capture log close
log using whobenefitsreplication, replace text
//program:  whobenefitsreplication.do
//task:      Replication
//project:   Who Benefits? Race, Immigration, and Assumptions about Policy
//author: Jake Haselswerdt \ 2020-3-31

//program setup
version 15
clear all
set linesize 80
macro drop _all
set scheme s1mono
set more off

use whobenefitsreplication.dta, clear
global controls "partyid age race1 afamer lathisp race4-race7 educ female income" 

//Figure 1 Assumption experimental results
collapse (mean) prop_blackonly=benefit_blackonly (sebinomial) se_blackonly=benefit_blackonly, by(treatment)
serrbar prop_blackonly se_blackonly treatment, ylabel(0(.05).4) ytitle("Proportion assuming policy will" "benefit blacks only") xlabel(/*1(1)3*/,valuelabel angle(45) labsize(small)) xtitle("") xscale(r(.5 4.5)) scale(1.96) saving(blackonly_errbar, replace)
use whobenefitsreplication.dta, clear
collapse (mean) prop_immigonly=benefit_immigonly (sebinomial) se_immigonly=benefit_immigonly, by(treatment)
serrbar prop_immigonly se_immigonly treatment, ylabel(0(.05).4) ytitle("Proportion assuming policy will" "benefit immigrants only") xlabel(/*1(1)3*/,valuelabel angle(45) labsize(small)) xtitle("") xscale(r(.5 4.5)) scale(1.96) saving(immigonly_errbar, replace)

gr combine blackonly_errbar.gph immigonly_errbar.gph, col(2) note(95 percent confidence intervals displayed)
graph export proportion.png, as(png) width(700) replace 
use whobenefitsreplication.dta, clear

//Table 1 Black-only assumption
logit benefit_blackonly uncondtax condcash condtax sr2k
est sto black_simp
logit benefit_blackonly uncondtax condcash condtax sr2k c.sr2k#i.uncondtax c.sr2k#i.condcash c.sr2k#i.condtax
est sto black
logit benefit_blackonly uncondtax condcash condtax sr2k ideo $controls 
est sto blackideo_simp
logit benefit_blackonly uncondtax condcash condtax sr2k c.sr2k#i.uncondtax c.sr2k#i.condcash c.sr2k#i.condtax ideo $controls 
est sto blackideo

esttab black_simp black blackideo_simp blackideo using h1atablerr.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Perceptions that Blacks and Not Whites Benefit from the Policy.\label{tab:h1a}) mtitles("Simple" "Interactions" "\specialcell{Simple w/\\ controls}" "\specialcell{Interactions\\ \& controls}") nonumbers nobaselevels eqlabels(none)drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Symbolic racism scale&" "$\times$ Symbolic racism&") nonotes addnotes("Estimates are logit coefficients. Standard errors in parentheses." "Additional control variables included but not displayed.") legend

//Table 2 Immigrants-only assumption
logit benefit_immigonly uncondtax condcash condtax immigscale
est sto immig_simp
logit benefit_immigonly uncondtax condcash condtax immigscale c.immigscale#i.uncondtax c.immigscale#i.condcash c.immigscale#i.condtax
est sto immig
logit benefit_immigonly uncondtax condcash condtax immigscale ideo $controls 
est sto immigideo_simp
logit benefit_immigonly uncondtax condcash condtax c.immigscale c.immigscale#i.uncondtax c.immigscale#i.condcash c.immigscale#i.condtax ideo $controls
est sto immigideo

esttab immig_simp immig immigideo_simp immigideo using h1btablerr.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Perceptions that Immigrants and not Americans Born in the U.S. Benefit from the Policy.\label{tab:h1b}) mtitles("Simple" "Interactions" "\specialcell{Simple w/\\ controls}" "\specialcell{Interactions\\ \& controls}") nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Anti-immigration scale&" "$\times$ Anti-immigration&") nonotes addnotes("Estimates are logit coefficients. Standard errors in parentheses." "Additional control variables included but not displayed.") legend

//Table 3 & Figure 2 Policy approval with assumption X attitude interactions
reg approve i.benefit_blackonly##c.sr2k uncondtax condcash condtax ideo $controls
est sto blackapprove
margins, at(sr2k=(0(.1)1) benefit_blackonly=(0 1))
marginsplot, ytitle(Predicted policy approval) legend(size(small) cols(1) ring(0) pos(7) order(3 "Does not assume policy benefits blacks only" 4 "Assumes policy benefits blacks only")) title("") ylabel(1(1)7) scheme(s1mono) recast(line) recastci(rarea) ci1opts(fcolor(%30)) ci2opts(fcolor(%30))saving(sr2kapproveintbw, replace)

reg approve i.benefit_immigonly##c.immigscale uncondtax condcash condtax ideo $controls
est sto immigapprove
margins, at(immigscale=(0(.1)1) benefit_immigonly=(0 1)) 
marginsplot, ytitle(Predicted policy approval) legend(size(small) cols(1) ring(0) pos(7) order(3 "Does not assume policy benefits" "immigrants only" 4 "Assumes policy benefits immigrants only")) title("") ytitle("") ylabel(1(1)7) scheme(s1mono) recast(line) recastci(rarea) ci1opts(fcolor(%30)) ci2opts(fcolor(%30)) saving(immigapproveintbw, replace) 

reg approve i.benefit_blackonly##c.sr2k i.benefit_immigonly##c.immigscale uncondtax condcash condtax ideo $controls
est sto bothapprove

*Table 3
esttab blackapprove immigapprove bothapprove using h3abtable2rr.tex, replace label wrap varwidth(25) b(2) se(2) star(* .1 ** .05 *** .01) scalars("N Observations" "r2 R-squared") title(Policy Approval, Beneficiary Group Assumptions, and Group Attitudes \label{tab:h3ab}) mtitles("Race" "Immigration" "Both") nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Anti-immigration scale" "$\times$ Anti-immigration" "$\times$ Symbolic racism scale&" "$\times$ Symbolic racism&") order(1.benefit_blackonly sr2k 1.benefit_blackonly#c.sr2k 1.benefit_immigonly immigscale 1.benefit_immigonly#c.immigscale) nonotes addnotes("Estimates are ordinary least squares coefficients. Standard errors in parentheses." "Additional control variables included but not displayed.") legend /*This one is the one I used*/

*Figure 2
gr combine sr2kapproveintbw.gph immigapproveintbw.gph, note("95 percent confidence intervals displayed") 
graph export predicted.png, as(png) width(700) replace

//Figure 4 - Indirect effect of work requirement treatment on approval mediated by assumptions

*Race
sem (benefit_blackonly <- conditional) (approve <- benefit_blackonly conditional sr2k benefitXsr2k)
est sto black_sem
vce
return list
matrix define sr2kmedvce=r(V)

gen ie_condsr2k=_b[benefit_blackonly:conditional]*(_b[approve:benefit_blackonly] + _b[approve:benefitXsr2k]*sr2k)
gen se_condsr2k=sqrt(((_b[approve:benefit_blackonly] + _b[approve:benefitXsr2k]*sr2k)^2) * sr2kmedvce[1,1] + (_b[benefit_blackonly:conditional]^2 + sr2kmedvce[1,1])*(sr2kmedvce[3,3] + 2*sr2kmedvce[3,6]*sr2k + sr2kmedvce[6,6]*(sr2k^2)))
gen hi_condsr2k=ie_condsr2k + 1.96*se_condsr2k
gen lo_condsr2k=ie_condsr2k - 1.96*se_condsr2k

twoway (line ie_condsr2k sr2k, lcolor(black) lpattern(solid)) (line hi_condsr2k sr2k, lcolor(black) lpattern(dash) sort) (line lo_condsr2k sr2k, lcolor(black) lpattern(dash) sort), legend(off) yline(0, lpattern(dash) lcolor(gs12)) ytitle("Indirect Effect of Work Requirement" "Treatment on Policy Approval") title("Mediated by" " 'Blacks Only' Assumption") saving(condsr2k, replace)

*Immigration
sem (benefit_immigonly <- conditional) (approve <- benefit_immigonly conditional immigscale benefitXimmigscale)
est sto immig_sem
vce
return list
matrix define immigmedvce=r(V)

gen ie_condimmig=_b[benefit_immigonly:conditional]*(_b[approve:benefit_immigonly] + _b[approve:benefitXimmigscale]*immigscale)
gen se_condimmig=sqrt(((_b[approve:benefit_immigonly] + _b[approve:benefitXimmigscale]*immigscale)^2) * immigmedvce[1,1] + (_b[benefit_immigonly:conditional]^2 + immigmedvce[1,1])*(immigmedvce[3,3] + 2*immigmedvce[3,6]*immigscale + immigmedvce[6,6]*(immigscale^2)))
gen hi_condimmig=ie_condimmig + 1.96*se_condimmig
gen lo_condimmig=ie_condimmig - 1.96*se_condimmig

twoway (line ie_condimmig immigscale, lcolor(black) lpattern(solid)) (line hi_condimmig immigscale, lcolor(black) lpattern(dash) sort) (line lo_condimmig immigscale, lcolor(black) lpattern(dash) sort), legend(off) yline(0, lpattern(dash) lcolor(gs12)) ytitle() title("Mediated by" " 'Immigrants Only' Assumption") saving(condimmig, replace)

*Combined graph
gr combine condsr2k.gph condimmig.gph, ycommon note("95 percent confidence intervals displayed") 
graph export condmed.png, replace

//Appendix B. Descriptive Statistics 

*Figure B.1 (mean approval rating by experimental condition) 
collapse (mean) mean_approve=approve (semean) se_approve=approve, by(treatment)
serrbar mean_approve se_approve treatment, ylabel(1(1)6) note(95 percent confidence intervals displayed) ytitle("Mean policy approval (7-point scale)") xlabel(/*1(1)3*/,valuelabel angle(45) labsize(small)) xtitle("") xscale(r(.5 4.5)) msym(point) scale(1.96) 
graph export mean.png, as(png) width(700) replace
use whobenefitsreplication.dta, clear

//Appendix D. Alternative specifications for assumptions

*Table D.1 - interactions with education  
logit benefit_blackonly uncondtax condcash condtax educ c.educ#i.uncondtax c.educ#i.condcash c.educ#i.condtax sr2k ideo $controls
est sto raceeduc 
logit benefit_immigonly uncondtax condcash condtax educ c.educ#i.uncondtax c.educ#i.condcash c.educ#i.condtax sr2k ideo $controls
est sto immigeduc

esttab raceeduc immigeduc using assump_educ.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Perceptions that Minorities and Not Majorities Benefit from the Policy, with Education Interactions.\label{tab:assump_educ}) mtitles("Blacks, not whites" "Immigrants, not born in US") nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "") nonotes addnotes("Estimates are logit coefficients. Standard errors in parentheses." "Additional control variables included but not displayed.") legend

*Table D.2 Ideology interactions 
logit benefit_blackonly uncondtax condcash condtax sr2k ideo c.ideo#i.uncondtax c.ideo#i.condcash c.ideo#i.condtax $controls 
est sto blackonly_ideoint
logit benefit_immigonly uncondtax condcash condtax immigscale ideo c.ideo#i.uncondtax c.ideo#i.condcash c.ideo#i.condtax $controls 
est sto immigonly_ideoint

esttab blackonly_ideoint immigonly_ideoint using assumption_ideoint.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Perceptions that Minority and Not Majority Groups Benefit from the Policy, with Ideology Interactions.\label{tab:assump_ideoint}) mtitles("Blacks Only" "Immigrants Only") nonumbers nobaselevels eqlabels(none) order(uncondtax condcash condtax ideo 1.uncondtax#c.ideo 1.condcash#c.ideo 1.condtax#c.ideo sr2k immigscale) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "") nonotes addnotes("Estimates are logit coefficients. Standard errors in parentheses." "Additional control variables included but not displayed.") legend

*Table D.3 Partisanship interactions
logit benefit_blackonly uncondtax condcash condtax sr2k partyid c.partyid#i.uncondtax c.partyid#i.condcash c.partyid#i.condtax ideo age race1 afamer lathisp race4-race7 educ female income 
est sto blackonly_partyidint
logit benefit_immigonly uncondtax condcash condtax immigscale partyid c.partyid#i.uncondtax c.partyid#i.condcash c.partyid#i.condtax ideo age race1 afamer lathisp race4-race7 educ female income 
est sto immigonly_partyidint

esttab blackonly_partyidint immigonly_partyidint using assumption_partyidint.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Perceptions that Minority and Not Majority Groups Benefit from the Policy, with Party Identification Interactions.\label{tab:assump_partyidint}) mtitles("Blacks Only" "Immigrants Only") nonumbers nobaselevels eqlabels(none) order(uncondtax condcash condtax partyid 1.uncondtax#c.partyid 1.condcash#c.partyid 1.condtax#c.partyid sr2k immigscale) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Party ID (7-point scale)" "$\times$ Party ID") nonotes addnotes("Estimates are logit coefficients. Standard errors in parentheses." "Additional control variables included but not displayed.") legend

*Table D.4 Multinomial model - race 
mlogit benefit_race uncondtax condcash condtax sr2k ideo $controls 
est sto race
esttab race using racemulti.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Experimental Effects on Race Assumptions, Multinomial Specification (Neither as Base Outcome) /*Change title*/\label{tab:racemulti}) nonumbers nobaselevels unstack noomitted substitute(=1 "" _ " ") drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) addnotes("Additional control variables included but not displayed")legend

*Table D.5 Multinomial model - race with interactions
mlogit benefit_race uncondtax condcash condtax sr2k c.sr2k#i.uncondtax c.sr2k#i.condcash c.sr2k#i.condtax ideo $controls
est sto raceint
esttab raceint using raceintmulti.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Experimental Effects on Race Assumptions with Interactions, Multinomial Specification (Neither as Base Outcome) /*Change title*/\label{tab:raceintmulti}) nonumbers nobaselevels unstack noomitted substitute(=1 "" _ " ") drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) addnotes("Additional control variables included but not displayed")legend

*Table D.6 Multinomial model - immigration
mlogit benefit_nation uncondtax condcash condtax immigscale ideo $controls 
est sto nation
esttab nation using nationmulti.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Experimental Effects on Nationality Assumptions, Multinomial Specification (Neither as Base Outcome) /*Change title*/\label{tab:nationmulti}) nonumbers nobaselevels unstack noomitted substitute(=1 "" _ " ") drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) addnotes("Additional control variables included but not displayed") legend

*Table D.7 Multinomial model - immigration with interactions
mlogit benefit_nation uncondtax condcash condtax immigscale c.immigscale#i.uncondtax c.immigscale#i.condcash c.immigscale#i.condtax ideo $controls 
est sto nationint
esttab nationint using nationintmulti.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Experimental Effects on Nationality Assumptions with Interactions, Multinomial Specification (Neither as Base Outcome) /*Change title*/\label{tab:nationintmulti}) nonumbers nobaselevels unstack noomitted substitute(=1 "" _ " ") drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) addnotes("Additional control variables included but not displayed") legend

*Table D.8 Multinomial model - both sets of group assumptions together
mlogit benefit_raceimmig uncondtax condcash condtax sr2k immigscale ideo $controls
est sto raceimmig
esttab raceimmig using raceimmigmulti.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Experimental Effects on Both Sets of Group Assumptions, Multinomial Specification (Neither as Base Outcome) /*Change title*/\label{tab:raceimmigmulti}) nonumbers nobaselevels unstack noomitted substitute(=1 "" _ " " "Blacks  not whites or immigrants" "\specialcell{Blacks, not whites \\ or immigrants}" "Immigrants  not blacks or born U" "\specialcell{Immigrants, not \\ born US or blacks}" "Blacks   immigrants  not whites" "\specialcell{Blacks \& immigrants, \\not whites or born US}") drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) addnotes("Additional control variables included but not displayed") legend

//Appendix E. Alternative specifications for policy approval

*Table E.1 and Figure E.1 (constituent term approach to approval models - race)
reg approve i.benefit_black##i.benefit_white##c.sr2k ideo $controls 
est sto raceconst
esttab raceconst using raceconst.tex,replace label wrap varwidth(25) b(2) se(2)  star(* .1 ** .05 *** .01) scalars("N Observations" "r2 R-squared") title(Model of Policy Approval with Separate Racial Group Assumptions and Interactions \label{tab:constrace}) nomtitles nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" or "" African-Americans "" "$\times$ Symbolic racism scale" " $\times$ Symbolic racism" ) addnotes("Additional control variables included but not displayed") legend 

*Figure E.1 (constituent term approach to approval models - race)
qui reg approve i.benefit_race##c.sr2k ideo $controls /*Easier for display*/
margins, over(benefit_race) at(sr2k=(0(.1)1))
marginsplot, ylabel(1(1)7) legend(pos(7) ring(0) col(1)) title("") ytitle(Predicted policy approval) note("95 percent confidence intervals displayed") recast(line) recastci(rarea) ci1opts(fcolor(%30)) ci2opts(fcolor(%30)) ci3opts(fcolor(%30)) ci4opts(fcolor(%30))
graph export raceconst.png, as(png) replace

*Table E.2 (constituent term approach to approval models - immigration)
reg approve i.benefit_immigrants##i.benefit_bornUS##c.immigscale ideo $controls 
est sto immigconst
esttab immigconst using immigconst.tex,replace label wrap varwidth(25) b(2) se(2) /*onecell*/ star(* .1 ** .05 *** .01) scalars("N Observations" "r2 R-squared") title(Model of Policy Approval with Separate Nationality Assumptions and Interactions \label{tab:constimmig}) nomtitles nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Anti-immigration scale" "Anti-immigration") addnotes("Additional control variables included but not displayed") legend 

*Figure E.2 (constituent term approach to approval models - immigration)
qui reg approve i.benefit_nation##c.immigscale ideo $controls /*Easier for display*/
margins, over(benefit_nation) at(immigscale=(0(.1)1))
marginsplot, ylabel(1(1)7) legend(pos(7) ring(0) col(1)) title("") ytitle(Predicted policy approval) note("95 percent confidence intervals displayed") recast(line) recastci(rarea) ci1opts(fcolor(%30)) ci2opts(fcolor(%30)) ci3opts(fcolor(%30)) ci4opts(fcolor(%30))
graph export immigconst.png, as(png) replace

*Do party assumptions affect approval results? Incorporate into old Appendix D
reg approve i.benefit_blackonly##c.sr2k support_dem i.support_dem#c.sr2k ideo $controls /*The party & SR2K interaction is strongly significant but including it doesn't really do anything to the race & SR2K interaction*/
est sto blackparty
reg approve i.benefit_immigonly##c.immigscale support_dem i.support_dem#c.immigscale ideo $controls /*Same here*/
est sto immigparty

esttab blackparty immigparty using party.tex,replace label wrap varwidth(25) b(2) se(2) /*onecell*/ star(* .1 ** .05 *** .01) scalars("N Observations" "r2 R-squared") title(Model of Policy Approval Incorporating Assumptions of Party Support with Interactions /*Change title*/ \label{tab:party}) nomtitles nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Anti-immigration scale" "$\times$ Anti-immigration" "$\times$ Symbolic racism scale&" "$\times$ Symbolic racism&") order(1.benefit_blackonly 1.benefit_immigonly support_dem sr2k immigscale 1.benefit_blackonly#c.sr2k 1.benefit_immigonly#c.immigscale 1.support_dem#c.sr2k 1.support_dem#c.immigscale) addnotes("Additional control variables included but not displayed") legend 

ttest benefit_blackonly, by(support_dem) /*They are significantly associated*/
ttest benefit_immigonly, by(support_dem)

//Appendix F. Subgroup analyses

*Figures F.1 & F.2 Assumptions
foreach a in black immig{
foreach v in age01 lib01 dem01 female nonwhite educ01 income01{
logit benefit_`a'only i.conditional##i.`v'
margins, dydx(conditional) over(`v')
marginsplot, recast(scatter) title("") ytitle("") xtitle("") xscale(r(-.35 1.35)) ylabel(-.25(.05).05, angle(0)) yline(0, lpattern(dash)  lcolor(gs14)) saving(`a'`v', replace)
}
gr combine `a'age01.gph `a'lib01.gph `a'dem01.gph `a'educ01.gph `a'income01.gph `a'nonwhite.gph `a'female.gph, note(Groups underrepresented in the sample are on the right in each plot.)
graph export `a'only_subgroup.png, as(png) replace
}

*Figures F.3 & F.4 Approval
local scales "sr2k immigscale"
local groups "black immig"

forvalues i = 1/2{
local a: word `i' of `scales'
local g: word `i' of `groups'
foreach v in age01 lib01 dem01 female nonwhite educ01 income01{
reg approve i.benefit_`g'only##c.`a'##i.`v'
margins, dydx(benefit_`g'only) at(`a'=(0(.1)1) `v'=(0 1))
marginsplot, title("") ytitle("") xtitle("") ylabel(-3(1)1, angle(0)) yline(0, lpattern(dash) lcolor(gs14)) xlabel(0(.5)1) recast(line) recastci(rarea) ci1opts(fcolor(%30)) ci2opts(fcolor(%30)) legend(size(small) symxsize(10) keygap(.5)) saving(`a'`v', replace)
}
gr combine `a'age01.gph `a'lib01.gph `a'dem01.gph `a'female.gph `a'nonwhite.gph `a'educ01.gph `a'income01.gph, note("Groups underrepresented in the sample are represented by dashed lines and lighter-colored confidence" "intervals in each plot.")
graph export `a'_subgroup.png, as(png) replace
}

//Appendix G. Weighted analyses 

*Table G.1 Replicating Table 1 - race assumption
logit benefit_blackonly uncondtax condcash condtax sr2k [pw=weight]
est sto black_simp_w
logit benefit_blackonly uncondtax condcash condtax sr2k c.sr2k#i.uncondtax c.sr2k#i.condcash c.sr2k#i.condtax [pw=weight]
est sto black_w
logit benefit_blackonly uncondtax condcash condtax sr2k ideo $controls [pw=weight]
est sto blackideo_simp_w
logit benefit_blackonly uncondtax condcash condtax sr2k c.sr2k#i.uncondtax c.sr2k#i.condcash c.sr2k#i.condtax ideo $controls [pw=weight]
est sto blackideo_w

esttab black_simp_w black_w blackideo_simp_w blackideo_w using h1atablerr_w.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Perceptions that Blacks and Not Whites Benefit from the Policy, with Survey Weights.\label{tab:h1a_w}) mtitles("Simple" "Interactions" "\specialcell{Simple w/\\ controls}" "\specialcell{Interactions\\ \& controls}") nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Symbolic racism scale&" "$\times$ Symbolic racism&") nonotes addnotes("Estimates are logit coefficients. Robust standard errors in parentheses." "Additional control variables included but not displayed.") legend

*Table G.2 Replicating Table 2 - immigration assumption
logit benefit_immigonly uncondtax condcash condtax immigscale [pw=weight]
est sto immig_simp_w
logit benefit_immigonly uncondtax condcash condtax immigscale c.immigscale#i.uncondtax c.immigscale#i.condcash c.immigscale#i.condtax [pw=weight]
est sto immig_w
logit benefit_immigonly uncondtax condcash condtax immigscale ideo $controls [pw=weight]
est sto immigideo_simp_w
logit benefit_immigonly uncondtax condcash condtax c.immigscale c.immigscale#i.uncondtax c.immigscale#i.condcash c.immigscale#i.condtax ideo $controls [pw=weight]
est sto immigideo_w

esttab immig_simp_w immig_w immigideo_simp_w immigideo_w using h1btablerr_w.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* .1 ** .05 *** .01) scalars("N Observations" "r2_p Pseudo R-squared") title(Perceptions that Immigrants and not Americans Born in the U.S. Benefit from the Policy, with Survey Weights .\label{tab:h1b_w}) mtitles("Simple" "Interactions" "\specialcell{Simple w/\\ controls}" "\specialcell{Interactions\\ \& controls}") nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Anti-immigration scale&" "$\times$ Anti-immigration&") nonotes addnotes("Estimates are logit coefficients. Standard errors in parentheses." "Additional control variables included but not displayed.") legend

*Table G.3 Replicating Table 3 - approval
reg approve i.benefit_blackonly##c.sr2k uncondtax condcash condtax ideo $controls [pw=weight]
est sto blackapprove_w
reg approve i.benefit_immigonly##c.immigscale uncondtax condcash condtax ideo $controls [pw=weight]
est sto immigapprove_w
reg approve i.benefit_blackonly##c.sr2k i.benefit_immigonly##c.immigscale uncondtax condcash condtax ideo $controls [pw=weight]
est sto bothapprove_w

esttab blackapprove_w immigapprove_w bothapprove_w using h3abtable2rr_w.tex, replace label wrap varwidth(25) b(2) se(2) star(* .1 ** .05 *** .01) scalars("N Observations" "r2 R-squared") title(Policy Approval, Beneficiary Group Assumptions, and Group Attitudes, with Survey Weights /*Change title*/\label{tab:h3ab_w}) mtitles("Race" "Immigration" "Both") nonumbers nobaselevels eqlabels(none) drop(age race1 afamer lathisp race4 race5 race6 race7 educ female income) substitute(=1 "" "$\times$ Anti-immigration scale" "$\times$ Anti-immigration" "$\times$ Symbolic racism scale&" "$\times$ Symbolic racism&") order(1.benefit_blackonly sr2k 1.benefit_blackonly#c.sr2k 1.benefit_immigonly immigscale 1.benefit_immigonly#c.immigscale) nonotes addnotes("Estimates are ordinary least squares coefficients. Standard errors in parentheses." "Additional control variables included but not displayed.") legend /*This one is the one I used*/

//Appendix H. Mediated moderation

*Table H.1 Race
sem (benefit_blackonly <- conditional) (approve <- benefit_blackonly conditional sr2k benefitXsr2k)
est sto black_sem
esttab black_sem using blacksem.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* 0.1 ** 0.05 *** .01) nonumbers title(Mediated Moderation Model of Policy Approval (Work Requirement Treatment Effect Mediated by Assumption that Blacks, not Whites, Will Benefit).\label{tab:blacksem}) substitute("Conditional program" "Work requirement") drop(var(e.benefit_blackonly) var(e.approve))

*Table H.2 Immigration
sem (benefit_immigonly <- conditional) (approve <- benefit_immigonly conditional immigscale benefitXimmigscale)
est sto immig_sem
esttab immig_sem using immigsem.tex, replace label wrap varwidth(25) b(2) se(2) starlevels(* 0.1 ** 0.05 *** .01) nonumbers title(Mediated Moderation Model of Policy Approval (Work Requirement Treatment Effect Mediated by Assumption that Immigrants, not People Born in the US, Will Benefit).\label{tab:immigsem}) substitute("Conditional program" "Work requirement") drop(var(e.benefit_immigonly) var(e.approve))

log close
exit
